﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WinForms = System.Windows.Forms;

namespace PeerComLink
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainView : Window
    {
        public MainView()
        {
            InitializeComponent();

            this.Left = System.Windows.SystemParameters.WorkArea.Width - this.Width - 10;
            this.Top = 10;
            this.DataContext = App.RunningData;
        }

        private void txtUsernameOnFocus(object sender, RoutedEventArgs e)
        {
            txtUsername.Margin = new Thickness(txtUsername.Margin.Left, txtUsername.Margin.Top, 52, txtUsername.Margin.Bottom);
            txtUsername.Cursor = Cursors.IBeam;
            txtUsername.IsReadOnly = false;
            btnSave.Visibility = Visibility.Visible;
        }

        private void txtUsernameOnLostFocus(object sender, RoutedEventArgs e)
        {
            btnSave.Visibility = System.Windows.Visibility.Hidden;
            txtUsername.IsReadOnly = true;
            txtUsername.Cursor = Cursors.Hand;
            txtUsername.Margin = new Thickness(txtUsername.Margin.Left, txtUsername.Margin.Top, 10, txtUsername.Margin.Bottom);
        }
    }
}
